<%@ include file="/include/taglibs.jsp"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<link rel="stylesheet" type="text/css" href="${ctx}/css/head.css"/>
<link rel="stylesheet" type="text/css" href="${ctx}/css/login.css"/>
<link rel="stylesheet" type="text/css" href="${ctx}/css/dialog.css"/>
<link rel="stylesheet" type="text/css" href="${ctx}/css/common.css"/>
<link rel="stylesheet" type="text/css" href="${ctx }/css/popup.css" />
<link rel="stylesheet" type="text/css" href="${ctx }/css/base.css" />
<link href="${ctx}/css/orderForm.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${ctx}/script/jquery/jquery_last.js"></script>
<script type="text/javascript" src="${ctx}/script/jquery/jquery.jmpopups-0.5.1.js"></script>
<script type="text/javascript" src="${ctx}/script/JBF/button.js"></script>
<script type="text/javascript">
$.setupJMPopups({ //设置蒙层颜色，默认为"#000"
	screenLockerBackground: "#666666",
	screenLockerOpacity: "0.5"  //弹出新窗口后背景锁定的颜色透明度，默认为"0.5"
});
function quickBuy(){
  if($("#buyUrl").val()!=null && $("#buyUrl").val()!=''){
	var ajaxUrl="${ctx}/user/systemUserAction!ajaxUserHasLogin.action";
	$.ajax({
		type: "post",
		url: ajaxUrl,
		dataType: "text",
		data:{"timeTemp":new Date().getTime()},   
		success: function(data){
			  if(data=='02'){//未登录
				  $.openPopupLayer({
						name: "quickLogin",
						width: 650,
						parameters: {"TimeFlags":Date.parse(new Date())},
						url: "${ctx}/user/systemUserAction!gotoQuickLogin.action"
					});
			  }else{//已登录
				  if($("#buyUrl").val()!=null && $("#buyUrl").val()!=''){
							$.openPopupLayer({
								name: "showGoodDiv",
								width: 1050,
								//target: "sendblessDiv",
								parameters: {"TimeFlags":Date.parse(new Date())},
								url: "${ctx}/buycar/buycarAction!parseGoodInfo.action?parseUrl="+$("#buyUrl").val()
							});
				  }
			  }
			}
	});
  }else{
	  $("#tip").show();
	  $("#tipText").html("请填写要解析的url");
  }
}	
$(document).ready(function(){
	$("#tip").hide();
	
	$("#buyUrl").focus(function(){
		$("#tip").show();
	});
	(function(){
		 var tip=JBF.el("tip");
		 if(tip && JBF.getBrowseIsIe()){
			 if(JBF.getBrowseVersion()<=7){
				 tip.style.marginTop="39px";
			 }else{
				 tip.style.marginTop="36px";
			 }
		 }

	})();
	
	//获取购物车商品数量
	var name="${loginuser.username}";
	if(name!=null && name!=''){
		var ajaxUrl="${ctx}/buycar/buycarAction!ajaxForBuyCarNum.action";
		$.ajax({
			type: "post",
			url: ajaxUrl,
			cache:false,
			dataType: "text",
			data:{"timeTemp":new Date().getTime()},   
			success: function(data){
				  $("#buyCarNum").html("购物车中有"+data+"件商品");
				}
			});
	}
});
/**
 * 去结算
 */
 function gotoBuyCarGoods(){
	window.location.href="${ctx}/buycar/buycarAction!gotoBuyCarGoods.action";
}

</script>
<div class="topHead">
	<div class="head_menu_wraper">
		<div class="menu_wraper">
			<div class="left_menu" id="loginBlack" name='loginBlack'>
			    <c:if test="${empty loginuser}">
				<a href="${ctx}/user/systemUserAction!gotoLogin.action" >登 录</a> <a>｜</a><a href='${ctx}/user/systemUserAction!gotoReg.action' >注册</a><br/>
				</c:if>
				<c:if test="${not empty loginuser}">
			   <div class="welcome" id="logined" >你好 <font color="#FF0000">${loginuser.username}</font> 欢迎光临采购部落 <a href="${ctx}/homeAction!logout.action" >退出</a></div> 
			</c:if>	
			</div>
			<div class="right_menu">
				<ul>
					<li><a href="${ctx}/publishnews/publishNewsAction!gotoHelpCenter.action">帮助中心</a></li>
					<li><a href="#">常见问题</a>｜</li>
					<li><a href="${ctx}/account/accountAction!gotoMyAccount.action">我的账户</a>｜</li>
					<li><a href="${ctx}/buycar/buycarAction!gotoBuyCarGoods.action">购物车</a> |</li>
				</ul>
			</div>
		</div>
	</div>
	<div class="head_content_wraper">
		<div class="content_wraper">
			<div class="logo"></div>
			<div class="buyAddress">
				<div class="buyInput">
					<input type="text"  id="buyUrl" name="buyUrl" />
				</div>
				<div class="buyButton" id="buyButton">
					<a href="javascript:quickBuy()">快速代购</a>
				</div>
				<div class="tip" id="tip"><div class="tipText" id="tipText">请输入正确的ip地址以方便进行查询</div></div>
			</div>
		</div>
	</div>
	<div class="head_main_menu">
		<div class="main_menu_wraper">
			<div class="main_menu">
				<ul>
					<li><a href="${ctx}/homeAction!init.action" class="menuSelected"><div>首&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;页</div></a></li>

					<li><a href="#"><div>自助购物</div></a></li>

					<li><a href="#"><div>直销商品</div></a></li>

					<li><a href="${ctx}/comment/commentAction!searchComment.action"><div>客户评价</div></a></li>

					<li><a href="${ctx }/buyguide/buyguideAction!searchBuyguide.action"><div>购物导航</div></a></li>

					<li><a href="#"><div style="border-right: solid 0px #FFFFFF;">费用估算</div></a></li>
				</ul>
			</div>
			<div class="buyCar">
				<table style="margin-left: 35px;">
					<tr>
						<td class="buyText" id="buyCarNum">购物车中有0件商品</td>
						<td class="balanceText"><a href="javascript:gotoBuyCarGoods()">去结算</a></td>
					</tr>
				</table>
			</div>
		</div>
	</div>
</div>